package com.me.study;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class TestEncode {
	
	public static void main(String[] args) {
		//System.out.println(String.format("%06d", 1));
//					 ISDN%5B30B   D%5D
//					 ISDN%5B30B%2BD%5D
		String s =  "ISDN%5B30B%2BD%5D%252C";
				   //ISDN%5B30B%2BD%5D--ISDN%255B30B%252BD%255D		js:encodeURIComponent()
				   //ISDN%5B30B%2BD%5D--ISDN%255B30B%252BD%255D
		String s1 = "ISDN%255B30B%252BD%255D";
				   //ISDN%255B30B%252BD%255D				js:encodeURIComponent(encodeURIComponent())
				   //ISDN%255B30B%252BD%255D
		String ss = "ISDN[30B+D],";//ISDN%255B30B%252BD%255D
//		try {
//			ss = new String(s.getBytes("ISO-8859-1"), "UTF-8");
//			System.out.println(ss);
//		} catch (UnsupportedEncodingException e) {
//			e.printStackTrace();
//		}
		try {
			System.out.println("1:Decoder1--" + URLDecoder.decode(s1,"UTF-8"));
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println("2:Decoder2--" + URLDecoder.decode(URLDecoder.decode(s1)));
		System.out.println("3:Encoder--" + URLEncoder.encode(ss));
		System.out.println("4:Encoder2--" + URLEncoder.encode(URLEncoder.encode(ss)));
		
		System.err.println("5:ssss--".replace(" ", "+"));
	}

}
